package org.bluedream.core.module.entity.stock;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.bluedream.comm.base.OrgPageEntity;
import org.bluedream.comm.utils.excel.ExcelType;
import org.bluedream.comm.utils.excel.FieldType;
import org.bluedream.core.module.entity.goods.Goods;
import org.bluedream.core.module.entity.warehouse.WareHouse;

import java.math.BigDecimal;

/**
 * @ClassName SkuStock
 * @Description TODO
 * @Author foxsand
 * @Data 2021-11-15 10:29
 * @Version
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@TableName(value = "sku_stock")
public class SkuStock extends OrgPageEntity<SkuStock> {
    private static final long serialVersionUID = 8792065446065621134L;

    @NonNull
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "仓库代码" , fieldSort = 1)
    private String warCode;

    @NonNull
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "商品代码" , fieldSort = 3)
    private String code;

    @NonNull
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "数量" , fieldSort = 7)
    private BigDecimal qty;

    @NonNull
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "单价" , fieldSort = 6)
    private BigDecimal oprice;

    @NonNull
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "金额" , fieldSort = 8)
    private BigDecimal total;

    @TableField(exist = false)
    private WareHouse wareHouse;

    @TableField(exist = false)
    private Goods goods;

    @TableField(exist = false)
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "仓库名称" , fieldSort = 2)
    private String wareName;
    @TableField(exist = false)
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "商品名称" , fieldSort = 5)
    private String name;
    @TableField(exist = false)
    @FieldType(excelType = ExcelType.EXPORT , isRequired = true , excelFieldName = "商品条码" , fieldSort = 4)
    private String barcode;

    public void setOprice(BigDecimal oprice){
        this.oprice = oprice;
    }

    public BigDecimal getOprice(){
        return this.oprice;
    }

    public SkuStock(){
        this.qty = new BigDecimal("0");
        this.total = new BigDecimal("0");
        this.oprice = new BigDecimal("0");
    }

    public SkuStock(String id) {
        this.id = id;
    }

    public SkuStock(long limit , long pageSize) {
        this.limit = limit;
        this.page = pageSize;
    }
}
